﻿//-----------------------------------------------------------------------
// <copyright file="AccountService.cs" company="SLWY Enterprises">
// * Copyright (C) 2017 四川商旅无忧科技有限公司 版权所有。
// * version : 1.0
// * author  : qinchaoyue
// * FileName: AccountService.cs
// * history : created by qinchaoyue 2017-10-16 10:30:15
// </copyright>
//-----------------------------------------------------------------------

using AutoMapper;
using Slwy.Application.Dtos;
using Slwy.Application.Interfaces;
using Slwy.Core.Models;
using Slwy.Utility.Extensions;

namespace Slwy.Application.Services
{
    using System.Linq;
    using System.Threading;

    using Slwy.Application.Dtos;
    using Slwy.Core.Entities;
    using Slwy.Data.Entity.Interfaces;

    /// <summary>
    /// The account service.
    /// 账户服务
    /// </summary>
    public class AccountService : IAccountService
    {
        /// <summary>
        /// 帐号 仓储
        /// </summary>
        private IRepository<AccountInfoEntity, string> _userInfoRepository;

        /// <summary>
        /// Initializes a new instance of the <see cref="AccountService"/> class. 
        /// </summary>
        /// <param name="userInfoRepository"> 帐号仓储 </param>
        public AccountService(IRepository<AccountInfoEntity, string> userInfoRepository)
        {
            this._userInfoRepository = userInfoRepository;
        }

        /// <summary>
        /// The add user info.
        /// </summary>
        /// <param name="dto">
        /// The dto.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool AddUserInfo(UserInfoDto dto)
        {
            return true;
        }

        /// <summary>
        /// The get user info.
        /// </summary>
        /// <param name="id">
        /// The id.
        /// </param>
        /// <returns>
        /// The <see cref="AccountInfo"/>.
        /// </returns>
        public AccountOutDto GetUserInfo(string id)
        {
            var userInfoEntity = this._userInfoRepository.GetByKey(id);
             return userInfoEntity.MapTo<AccountOutDto>();
        }
    }
}
